﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="XhciUsbPort"
	type="http://metalx.org/Usb/Xhci/XhciUsbPort"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:date="http://metalx.org/i386/Functions/Date"
	xmlns:time="http://metalx.org/i386/Functions/Time"
	xmlns:clk="http://metalx.org/i386/Functions/Clock"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:bool="http://metalx.org/i386/Functions/Boolean"
	xmlns:lst="http://metalx.org/i386/Functions/List"
	xmlns:pcif="http://metalx.org/i386/Functions/Pci"
	xmlns:hex="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:imm="http://metalx.org/Intel/80386/Immediate"
	xmlns:usb="http://metalx.org/Usb/Ohci/Registers"
	xmlns:pci="http://metalx.org/Pc/Pci/Ports"
	xmlns:cfg="http://metalx.org/Pc/Pci/Configuration">

	<cls:field name="Device" type="http://metalx.org/Pci/PciDevice" offset="0"/>
	<cls:field name="Port" type="http://metalx.org/Integer" offset="4"/>

	<cls:method name="GetStatus" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:CopyOperandToRegister/>
		<op:BX-SIAddressPlusImmediate8/>
		<byte>4</byte>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<cpu:CopyOperandToRegister8/>
		<op:AL-SIAddress/>

		<cpu:AddImmediateToAL/>
		<hex>44</hex>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>4</int>
		
		<cpu:ArithmeticDXAXOperandFunction/>
		<ari:MultiplyByBXRegister/>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<hex:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsConnected" type="http://metalx.org/Boolean">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:CopyOperandToRegister/>
		<op:BX-SIAddressPlusImmediate8/>
		<byte>4</byte>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<cpu:CopyOperandToRegister8/>
		<op:AL-SIAddress/>

		<cpu:AddImmediateToAL/>
		<hex>44</hex>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>4</int>

		<cpu:ArithmeticDXAXOperandFunction/>
		<ari:MultiplyByBXRegister/>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="IsEnabled" type="http://metalx.org/String">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:CopyOperandToRegister/>
		<op:BX-SIAddressPlusImmediate8/>
		<byte>4</byte>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<cpu:CopyOperandToRegister8/>
		<op:AL-SIAddress/>

		<cpu:AddImmediateToAL/>
		<hex>44</hex>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>4</int>

		<cpu:ArithmeticDXAXOperandFunction/>
		<ari:MultiplyByBXRegister/>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<cpu:ShiftRegisterByImmediateFunction8/>
		<shift:ShiftALRegisterRight/>
		<byte>2</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
	
	<cls:method name="IsPowered" type="http://metalx.org/String">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddress/>

		<cpu:CopyOperandToRegister/>
		<op:BX-SIAddressPlusImmediate8/>
		<byte>4</byte>

		<pcif:GetBaseAddress0/>

		<cpu:AndAXWithImmediate/>
		<hex>fffffff0</hex>

		<cpu:CopyRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>0</int>

		<cpu:CopyOperandToRegister8/>
		<op:AL-SIAddress/>

		<cpu:AddImmediateToAL/>
		<hex>44</hex>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopyImmediateToAX/>
		<int>4</int>

		<cpu:ArithmeticDXAXOperandFunction/>
		<ari:MultiplyByBXRegister/>

		<cpu:AddRegisterToOperand/>
		<op:AX-SIRegister/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>12</byte>

		<cpu:AndALWithImmediate/>
		<binary>00000001</binary>

		<bool:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="deviceName" type="Absolute32"/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>

		<var:string id="deviceName">Universal Serial Bus 2.0 Controller Port</var:string>
	</cls:method>
	
	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>